<html>
<head>

<title>บันทีกแก้ไขข้อมูลสมาชิก</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <table width="575" border="0" align="center" cellpadding="0" cellspacing="0"><tr>
    <td width="10">&nbsp;</td>
    <td valign="top"><div align="center"><br>
<?php 
include(APPPATH."views/fontend/register/config.inc.php") ;
//print_r($_REQUEST);
echo "<BR>";
$name = $_POST['name'];
$age = $_POST['age'];
$province = $_POST['province'];
//$user_name = $_POST['user_name'];
//$pwd_name1 = $_POST['pwd_name1'];
$email = $_POST['email'];
$date = $_POST['date'];
$month = $_POST['month'];
$year = $_POST['year'];
$sex = $_POST['sex'];
$address = $_POST['address'];
$amper = $_POST['amper'];
$zipcode= $_POST['zipcode'];
$phone = $_POST['phone'];
$education = $_POST['education'];
$work = $_POST['work'];
$member_id = $_POST['member_id'];
//mysql_select_db($db) ;

// ถ้ากรอกอีเมล์ไม่ถูกต้อง
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$email)){
echo "<br><br><center><font size='3' face='MS Sans Serif'><b>กรุณากรอกอีเมล์ให้ถูกต้องด้วยครับ</b></font>" ;
echo "<br><br><input type='button' value='edit email' onclick='history.back();'></center>" ;
exit() ;
}


$signup = date("j/n/").(date("Y")+543) ;

$name = htmlspecialchars($name) ;
$address = htmlspecialchars($address) ;
$zipcode = htmlspecialchars($zipcode) ;
$phone = htmlspecialchars($phone) ;


	    $sql[0] = "update member set name='$name' where member_id='$member_id' ";
		
		$sql[1]= "update member set sex='$sex' where member_id='$member_id' ";
		
		$sql[2] = "update member set date='$date' where member_id='$member_id' ";
       
        $sql[3] = "update member set month='$month' where member_id='$member_id' ";
               
        $sql[4] = "update member set year='$year' where member_id='$member_id' ";
      
		$sql[5] = "update member set work='$work' where member_id='$member_id'";
	
		$sql[6] = "update member set age='$age' where member_id='$member_id' ";
	
		$sql[7] = "update member set email='$email' where member_id='$member_id' ";
	
		$sql[8] = "update member set address='$address' where member_id='$member_id' ";
	
		$sql[9] = "update member set amper='$amper' where member_id='$member_id' ";
		
		$sql[10] = "update member set province='$province' where member_id='$member_id' ";
	
	    $sql[11] = "update member set zipcode ='$zipcode' where member_id='$member_id' ";

		$sql[12] = "update member set phone='$phone' where member_id='$member_id' ";
	
		$sql[13] = "update member set education='$education' where member_id='$member_id' ";
		
	   $sql[14] = "update member set work='$work' where member_id='$member_id' ";
	
       for($i=0;$i<15;$i++) {
      $result = mysql_query($sql[$i]) or die("Err program")  ;
       }


if($result) {
?>
<!--<script language="javascript" type="text/javascript">
    alert("บันทึกการเปลี่ยนแปลงเรียบร้อยแล้ว");
</script>-->
<?
echo "<br><br><center><font size=\"3\" face='MS Sans Serif'><b>รายละเอียดของคุณ ได้ถูกบันทึกใหม่แล้วครับ<br>กรุณารอสักครู่...</b></font></center>" ;
echo "<meta http-equiv='refresh' content='2; url=member_detail.php'>" ;
}
?>
  </td>
  </tr>
</table>
<table width="575" border="0" align="center" cellpadding="0" cellspacing="0"><tr>
    <td width="10">&nbsp;</td>
    <td valign="top"><div align="center"><br>
        <br>
        <table width="575" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr> 
            <td><div align="center"> 
                <p><font color="#000000" size="2" face="MS Sans Serif, Tahoma, sans-serif"><strong> 
                  </strong></font></p>
              </div>
              <blockquote> 
                <div align="left"> 
                  <p> <font color="#FF3300" size="3" face="MS Sans Serif, Tahoma, sans-serif"><u> 
                    </u></font></p>
                </div>
              </blockquote>
            
                <div align="left">
                  
                <table border="0" align="center" cellpadding="3" cellspacing="0">
                  <tr> 
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"> </font></td>
                    <td><div align="left"></div>
                      <font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                    <td colspan="2"> <font face="MS Sans Serif, Tahoma, sans-serif"><font size="2"></font></font></td>
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                    <td><div align="left"></div>
                      <font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                  </tr>
                  <tr> 
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                    <td colspan="2"><font size="2" face="MS Sans Serif, Tahoma, sans-serif">&nbsp;</font></td>
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                  </tr>
                  <tr> 
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                    <td colspan="2"><font size="2" face="MS Sans Serif, Tahoma, sans-serif">&nbsp;</font></td>
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                  <tr> 
                    <td colspan="6"><div align="center"><font size="2" face="MS Sans Serif, Tahoma, sans-serif">..............................................................................................................................................</font></div></td>
                  <tr> 
                    <td colspan="6"><p> 
                        <font color="#0000FF" size="3" face="MS Sans Serif, Tahoma, sans-serif"><u><font color="#CC00FF"></font></u> 
                        <br>
                        <br>
                        </font></p></td>
                  </tr>
                  <tr> 
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"> 
                      </font></td>
                    <td colspan="5"><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                  </tr>
                  <tr> 
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                    <td colspan="5"><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                  </tr>
                  <tr> 
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                    <td width="50">&nbsp;</td>
                    <td><div align="left"><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></div></td>
                    <td colspan="2"><div align="left"><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></div></td>
                  </tr>
                  <tr> 
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                    <td colspan="5"><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                  </tr>
                  <tr> 
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                    <td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></td>
                    <td>&nbsp;</td>
                    <td><div align="left"><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></div></td>
                    <td colspan="2"> <div align="left"><font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></div></td>
                  </tr>
                </table>
                <p align="center"><a href="<?=site_url()?>/template_u/register/logout.php"></a> 
                  &nbsp;&nbsp; <font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></p>
              </div>
           
              <div align="left"></div>
              <div align="left"></div>
              <div align="center"></div>
              <div align="center"></div></td>
          </tr>
        </table>
</div></td>
  </tr>
</table>
</body>
</html>